package com.example.guiguihomemedical.mapper;

import com.example.guiguihomemedical.entity.PersonalInfo;
import com.example.guiguihomemedical.entity.Record;
import org.apache.ibatis.annotations.*;

@Mapper
public interface PersonalInfoMapper {
    @Select("SELECT * FROM personalInfo WHERE idcard = #{idcard}")
    PersonalInfo getByIdcard(@Param("idcard") String idcard);
    @Insert("INSERT INTO personalInfo (idcard, registeredType, bloodType, occupation, maritalStatus, medicalPaymentMethod, drugAllergyHistory, exposureHistory, surgery, reason) "+
            "VALUES (#{idcard}, #{registeredType}, #{bloodType}, #{occupation}, #{maritalStatus}, #{medicalPaymentMethod}, #{drugAllergyHistory}, #{exposureHistory}, #{surgery}, #{reason})")
    void instrtPersonalInfo(PersonalInfo personalInfo);
    @Update("UPDATE personalInfo SET registeredType = #{registeredType}, bloodType = #{bloodType}, occupation = #{occupation}, maritalStatus = #{maritalStatus},"+
            " medicalPaymentMethod = #{medicalPaymentMethod}, drugAllergyHistory = #{drugAllergyHistory}, exposureHistory = #{exposureHistory}, surgery = #{surgery}, reason = #{reason}"+
            " WHERE idcard = #{idcard}")
    void updataPersonalInfo(PersonalInfo personalInfo);
}
